<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Sales Inquiry</title>
    </h:head>
    <f:view beforePhase="#{UserDisplayManagedBean.doDisplay}">
        <f:view beforePhase="#{SalesInquiryManagedBean.initView2}">
            <h:body>
                <h:form prependId="false">
                    <!-- IDLE DIALOG for -->
                    <p:confirmDialog message="You have been idle for 5 minutes. Do you want to continue?"  
                                     showEffect="bounce" hideEffect="explode"  
                                     header="Warning message" severity="alert" widgetVar="confirmation">  
                        <p:commandButton value="Yes" onclick="confirmation.hide()" type="button" /> 
                        <p:commandButton value="No" update="panel" oncomplete="confirmation.hide()"  
                                         actionListener="#{UserManagedBean.doLogout}" /> 
                    </p:confirmDialog>

                    <p:idleMonitor timeout="300000" onidle="confirmation.show()" />  
                    <!--END OF IDLE DIALOG-->

                    <p:growl id="growl" showDetail="true" />
                    <p:growl id="notif" showDetail="true" />
                    <div id="top" class="top">
                        <h:graphicImage value="/image/newHeader.jpg"/>
                    </div>

                    <div id="content">
                        <p:poll interval="5"   
                                actionListener="#{MessageManagedBean.checkNewMessage}" immediate="true" update="notif" />
                        <table>
                            <tr>
                                <td>
                                    <p:toolbar style="font-size:12px;margin-top:0%;height:30px;width:200px"> 
                                        <p:toolbarGroup align="right" >
                                            <p:button title="Home" image="ui-icon-home" outcome="SalesDeptWorkspace"/>                                  
                                            <p:button title="Notes" image="ui-icon-note" outcome="tasks"/>                                    
                                            <p:button title="Mail" outcome="messages" image="ui-icon-mail-closed"/>                                    
                                            <p:button title="Edit Preferences" image="ui-icon-gear"/>                                   
                                            <p:button title="Help" image="ui-icon-help"/>
                                            <p:commandButton title="Log Out" immediate="true" type="submit" image="ui-icon-close" actionListener="#{UserManagedBean.doLogout}"/> 
                                        </p:toolbarGroup>
                                    </p:toolbar></td>
                                <td>
                                    <h:graphicImage value="8522350.png" style="width:40px;height:40px" />
                                    <h:outputText value="         "/>
                                    <h:outputText value="Inquiries" style="font-family:Tahoma;font-size:20px;font-weight:bolder"/>
                                    <p:spacer width="100" height="10"/>
                                </td>
                            </tr>
                            <tr>
                                <td style="vertical-align:top">
                                    <p:menu style="width:200px;font-size: 12px;font-family: Tahoma;border-style: ridge">  
                                        <p:submenu label="Sales Force Automation" >  
                                            <p:menuitem value="Customers" url="http://localhost:8080/MerlionERP-war/CRM/customers.xhtml" ajax="false" icon="ui-icon ui-icon-person"/>  
                                            <p:menuitem value="Contacts" url="http://localhost:8080/MerlionERP-war/CRM/contacts.xhtml" ajax="false" icon="ui-icon ui-icon-person" />
                                            <p:menuitem value="Leads" url="http://localhost:8080/MerlionERP-war/CRM/salesLeads.xhtml" ajax="false" icon="ui-icon ui-icon-person" />
                                        </p:submenu>
                                        <p:submenu label="Sales Order Processing">
                                            <p:menuitem value="Pricebooks" url="http://localhost:8080/MerlionERP-war/CRM/pricebooks.xhtml" ajax="false" icon="ui-icon ui-icon-document"/>
                                            <p:menuitem value="Inquiries" url="http://localhost:8080/MerlionERP-war/CRM/salesInquiries.xhtml" ajax="false" icon="ui-icon ui-icon-document"/>
                                            <p:menuitem value="Quotations" url="http://localhost:8080/MerlionERP-war/CRM/quotations.xhtml" ajax="false" icon="ui-icon ui-icon-document"/>
                                            <p:menuitem value="Purchase Orders" url="http://localhost:8080/MerlionERP-war/CRM/purchaseOrders.xhtml" ajax="false" icon="ui-icon ui-icon-document"/>
                                            <p:menuitem value="Sales Orders" url="http://localhost:8080/MerlionERP-war/CRM/salesOrders.xhtml" ajax="false" icon="ui-icon ui-icon-document"/>
                                            <p:menuitem value="Delivery Orders" url="http://localhost:8080/MerlionERP-war/CRM/deliveryOrdersCRM.xhtml" ajax="false" icon="ui-icon ui-icon-document"/>
                                        </p:submenu>  
                                    </p:menu>
                                    <p:menu type="tiered" style="width:200px;font-family:Tahoma;font-size:12px">
                                        <p:submenu label="Create New" icon="ui-icon ui-icon-extlink">  
                                            <p:menuitem value="Customer" url="http://localhost:8080/MerlionERP-war/CRM/createNewCustomer.xhtml" />
                                            <p:menuitem value="Sales Lead" url="http://localhost:8080/MerlionERP-war/CRM/createNewSalesLead.xhtml" /> 
                                            <p:menuitem value="Contact" url="http://localhost:8080/MerlionERP-war/CRM/createNewContact.xhtml" />
                                            <p:menuitem value="Inquiry" url="http://localhost:8080/MerlionERP-war/CRM/addSalesInquiry.xhtml"/>
                                            <p:menuitem value="Quotation" url="http://localhost:8080/MerlionERP-war/CRM/addQuotation.xhtml"/>
                                            <p:menuitem value="Purchase Order" url="http://localhost:8080/MerlionERP-war/CRM/addPurchaseOrder.xhtml"/>
                                            <p:menuitem value="Sales Order" url="http://localhost:8080/MerlionERP-war/CRM/addSalesOrder.xhtml"/>
                                            <p:menuitem value="Delivery Order" url="http://localhost:8080/MerlionERP-war/CRM/addDeliveryOrder.xhtml"/>      
                                        </p:submenu>
                                    </p:menu>
                                    <p:calendar mode="inline" style="font-size:11px;font-family:Tahoma"/>
                                </td>

                                <td style="vertical-align:top">

                                    <p:toolbar style="background-color:  #d9bb73;font-size: 70%;width:99.5%"> 

                                        <!--<p:toolbarGroup align="left">  
                                            <h:outputLabel value="Search:"/>
                                            <h:inputText value="" id="search"/>
        
                                        </p:toolbarGroup>--> 
                                        <!--<p:divider />-->
                                        <p:toolbarGroup align="left">  
                                            <p:button value="New Inquiry" outcome="addSalesInquiry" image="ui-icon-plus"/>
                                            <p:button value="View Converted Inquiries" outcome="convertedInquiries" image="ui-icon-document"/>
                                            <p:commandButton value="Delete" title="Delete" image="ui-icon ui-icon-trash" oncomplete="deleteDialog.show()"/>                                   
                                            <!-- <p:commandButton value="Convert To Quotation" oncomplete="convertToQuotation.show()" 
                                                             update="panel" image="ui-icon ui-icon-transfer-e-w"/>-->
                                            <!-- <p:divider />  
                                             <p:commandButton type="push" title="Save" image="ui-icon-disk"/>  
                                             <p:commandButton type="push" title="Delete" image="ui-icon-trash"/>  
                                             <p:commandButton type="push" title="Print" image="ui-icon-print"/> -->
                                        </p:toolbarGroup>  

                                    </p:toolbar> 

                                    <p:dataTable id="panel" 
                                                 var="inquiries" value="#{SalesInquiryManagedBean.inquiryList}"                       
                                                 paginator="true" rows="5"  
                                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                                 rowEditListener="#{SalesInquiryManagedBean.onEditRow}"
                                                 rowsPerPageTemplate="5,10,15"  style="font-size:60%;width:100%"
                                                 selection="#{SalesInquiryManagedBean.selectedInquiries}"
                                                 emptyMessage="No data found with given criteria" widgetVar="salesInquiryTable">  


                                        <f:facet name="header">                           
                                            <p:outputPanel style="text-align:right"  >
                                                <h:outputText value="Search all fields:" style="margin-left:840px" />  
                                                <p:inputText id="globalFilter" onkeyup="salesInquiryTable.filter()" style="right:-100px;width:150px" />  
                                            </p:outputPanel>
                                        </f:facet>


                                        <p:column selectionMode="multiple" /> <!--style="border-left-color:transparent;border-right-color:transparent"/>-->


                                        <p:column headerText="View" style="width:20px;border-right-color:transparent"> <!--";border-right-color:transparent"> --> 
                                            <p:rowToggler />  
                                        </p:column> 

                                        <p:column headerText="Edit" style="width:20px;border-left-color:transparent;border-right-color:transparent">    
                                            <p:rowEditor/>
                                        </p:column>

                                        <p:column headerText="Del." style="width: 16px;border-left-color:transparent"> <!--"border-right-color:transparent"> --> 
                                            <!--DELETE-->
                                            <p:commandButton title="Delete" image="ui-icon ui-icon-trash" ajax="true" immediate="true"
                                                             update="panel" oncomplete="customerdialog.show()">
                                                <f:setPropertyActionListener target="#{SalesInquiryManagedBean.selectedInquiry}"
                                                                             value="#{inquiries}"/>
                                            </p:commandButton>
                                        </p:column>


                                        <!--SALES INQUIRY ID-->
                                        <p:column sortBy="#{inquiries.id}" filterBy="#{inquiries.id}" filterMatchMode="contains" 
                                                  filterStyle="width:50px" >
                                            <!--style="border-left-color:transparent;border-right-color:transparent">-->
                                            <f:facet name="header">
                                                <h:outputText value="ID"/>
                                            </f:facet>
                                            <h:outputText value="#{inquiries.id}"/>
                                        </p:column>

                                        <!--SALES INQUIRY NAME-->
                                        <p:column headerText="Name" sortBy="#{inquiries.documentName}" 
                                                  filterBy="#{inquiries.documentName}" filterMatchMode="contains">
                                            <!--style="border-left-color:transparent;border-right-color:transparent">-->  
                                            <p:cellEditor>
                                                <f:facet name="output">  
                                                    <h:outputText value="#{inquiries.documentName}">
                                                        <!--<f:convertDateTime pattern="dd/MM/yyyy"/>-->
                                                    </h:outputText>
                                                </f:facet>  
                                                <f:facet name="input">
                                                    <p:inputText value="#{inquiries.documentName}"/> 
                                                </f:facet>
                                            </p:cellEditor>
                                        </p:column>   

                                        <!--DATE ISSUED-->
                                        <p:column headerText="Date Issued" sortBy="#{inquiries.dateIssued}" 
                                                  filterBy="#{inquiries.dateIssued}" filterMatchMode="contains" >
                                   
                                                    <h:outputText value="#{inquiries.dateIssued}"/>
                                     
                                        </p:column>   


                                        <!--CLIENT NAME-->
                                        <p:column headerText="Client Name" sortBy="#{inquiries.clientName}" 
                                                  filterBy="#{inquiries.clientName}" filterMatchMode="contains"
                                                  filterStyle="width:80px" >
                                            <!--style="border-left-color:transparent;border-right-color:transparent"> -->

                                            <h:outputText id="clientName" value="#{inquiries.clientName}"/>

                                        </p:column>


                                        <!--Total Price-->
                                        <p:column headerText="Total Price" sortBy="#{inquiries.totalPrice}"
                                                  filterBy="#{inquiries.totalPrice}" filterMatchMode="contains"
                                                  filterStyle="width:60px" >
                                            <!--style="border-left-color:transparent;border-right-color:transparent"> -->

                                            <h:outputText  value="#{inquiries.totalPrice}"/>
                                        </p:column>

                                        <!--STATUS-->
                                        <p:column headerText="Status" sortBy="#{inquiries.status}" 
                                                  filterBy="#{inquiries.status}" filterMatchMode="contains">
                                            <!--style="border-left-color:transparent;border-right-color:transparent">-->
                                            <p:cellEditor>
                                                <f:facet name="output">
                                                    <h:outputText value="#{inquiries.status}"/>
                                                </f:facet>
                                                <f:facet name="input">            
                                                    <h:selectOneMenu value="#{inquiries.status}">
                                                        <f:selectItem itemLabel="Waiting for Confirmation" itemValue="Waiting for Confirmation"/>
                                                        <f:selectItem itemLabel="Approved" itemValue="Approved"/>                                        
                                                        <f:selectItem itemLabel="Voided" itemValue="Voided"/>
                                                    </h:selectOneMenu>
                                                </f:facet>
                                            </p:cellEditor>
                                        </p:column>


                                        <p:column style="width: 16px;border-right-color:transparent" >
                                            <!--border-left-color:transparent;border-right-color:transparent --> 
                                            <p:commandLink update="display1" oncomplete="inquiryDialog.show()" ajax="true" immediate="true">
                                                <p:graphicImage value="about_icon.png" style="width:20px;height:20px"/>           
                                                <f:setPropertyActionListener target="#{SalesInquiryManagedBean.selectedViewInquiry}" 
                                                                             value="#{inquiries}"  />                                                                    
                                            </p:commandLink>  
                                        </p:column>  

                                        <p:column>
                                            <p:commandButton update="display2" oncomplete="convertToQuotation.show()" ajax="true" immediate="true"
                                                             value="Convert To Quotation" rendered="#{!inquiries.voided}"  >
                                                <f:setPropertyActionListener target="#{SalesInquiryManagedBean.selectedViewInquiry}"
                                                                             value="#{inquiries}"/>
                                            </p:commandButton>
                                        </p:column> 

                                        <p:column>
                                            <p:commandButton image="ui-icon ui-icon-print" ajax="true" immediate="true"
                                                             actionListener="#{SalesInquiryManagedBean.generateSalesInquiryReport}">
                                                <f:setPropertyActionListener target="#{SalesInquiryManagedBean.selectedPrintInquiry}"        
                                                                             value="#{inquiries}"/>
                                            </p:commandButton>
                                        </p:column>

                                        <p:rowExpansion>  
                                            <h:panelGrid id="display" columns="3" cellpadding="3"
                                                         style="font-family:Tahoma; font-size:10px;border-color:transparent;column-rule-style:hidden">

                                                <h:outputText value="Sales Inquiry Id" />  
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{inquiries.id}" />


                                                <h:outputText value="Sales Inquiry Name" />  
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{inquiries.documentName}" />

                                                <h:outputText value="Date Issued" />  
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{inquiries.dateIssued}" />  

                                                <h:outputText value="Client Id" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{inquiries.clientId}" /> 

                                                <h:outputText value="Client Name" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{inquiries.clientName}" />

                                                <h:outputText value="Status" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{inquiries.status}" />

                                                <h:outputText value="Total Price" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{inquiries.totalPrice}" />

                                                <h:outputText value="Description" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{inquiries.description}" />

                                            </h:panelGrid>  
                                        </p:rowExpansion> 

                                    </p:dataTable>  

                                    <p:ajaxStatus style="width:16px;height:16px;">  
                                        <f:facet name="start">  
                                            <h:graphicImage value="25(2).gif" />  
                                        </f:facet>  

                                        <f:facet name="complete">  
                                            <h:outputText value="" />  
                                        </f:facet>  
                                    </p:ajaxStatus> 

                                    <p:dialog header="Sales Inquiry Detail" modal="true" widgetVar="inquiryDialog" resizable="false"  
                                              width="800" showEffect="drop" hideEffect="drop">  

                                        <!--<h:panelGrid id="display1" columns="1" cellpadding="4" style="font-family:Tahoma;font-size:12px" >-->  
                                        <p:panel id="display1" style="border-style: hidden;font-family:Tahoma;font-size:12px" >
                                            <center>
                                                <table cellpadding="4" width="100%" >
                                                    <tr>
                                                        <td width="55%" align="right" ><h:outputText value="ID" style="font-weight:bold" /></td>
                                                        <td width="5%"><h:outputText value=":"/></td>                                  
                                                        <td width="40%"><h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.id}" /></td>  
                                                    </tr>

                                                    <tr>
                                                        <td width="55%" align="right" ><h:outputText value="Inquiry Name" style="font-weight:bold" /></td>
                                                        <td width="5%"><h:outputText value=":"/></td>                                  
                                                        <td width="40%"><h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.documentName}" /></td>  
                                                    </tr>   

                                                    <tr>
                                                        <td align="right"><h:outputText value="Date Issued" style="font-weight:bold" /></td>
                                                        <td><h:outputText value=":"/></td>                                  
                                                        <td><h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.dateIssued}">                         
                                                            </h:outputText></td>
                                                    </tr>

                                                    <tr>
                                                        <td align="right"><h:outputText value="Client ID" style="font-weight:bold" /></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.clientId}" /></td>  
                                                    </tr>

                                                    <tr>
                                                        <td align="right"><h:outputText value="Client Name" style="font-weight:bold" /></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.clientName}" /></td>  
                                                    </tr>

                                                    <tr>
                                                        <td align="right"><h:outputText value="Status" style="font-weight:bold" /></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.status}" /></td>
                                                    </tr>

                                                    <tr>                                   
                                                        <td align="right"><h:outputText value="Total Price" style="font-weight:bold"/></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.totalPrice}"/></td>
                                                    </tr>

                                                    <tr>                                   
                                                        <td align="right"><h:outputText value="Description" style="font-weight:bold"/></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.description}"/></td>
                                                    </tr>

                                                    <tr> <td colspan="3" align="left" > 

                                                            <p:dataTable  id="childPanel" value="#{SalesInquiryManagedBean.selectedProductList}"
                                                                          rowEditListener ="#{SalesInquiryManagedBean.onEditLineEntry}"
                                                                          var="lineEntry" style="width:100%" >


                                                                <p:column style="width:20px">    
                                                                    <p:rowEditor/>
                                                                </p:column>

                                                                <p:column headerText="Product ID">

                                                                    <h:outputText value ="#{lineEntry.itemId}"/>
                                                                </p:column>

                                                                <p:column headerText="Product Name">
                                                                    <h:outputText value="#{lineEntry.itemName}"/>
                                                                </p:column>

                                                                <p:column headerText="Quantity">
                                                                    <p:cellEditor> 
                                                                        <f:facet name="output">
                                                                            <h:outputText value ="#{lineEntry.quantity}"/>
                                                                        </f:facet>
                                                                        <f:facet name="input">
                                                                            <p:inputText style="width:60px" value ="#{lineEntry.quantity}">
                                                                                <p:ajax event="rowEdit" update="totalPrice"/>
                                                                            </p:inputText>
                                                                        </f:facet>
                                                                    </p:cellEditor>

                                                                </p:column>

                                                                <p:column headerText="Base Unit Price">
                                                                    <h:outputText value="#{lineEntry.basePrice}"/>
                                                                </p:column>

                                                                <p:column headerText="List Price">
                                                                    <p:cellEditor>
                                                                        <f:facet name="output">
                                                                            <h:outputText value ="#{lineEntry.price}"/>
                                                                        </f:facet>
                                                                        <f:facet name="input">
                                                                            <p:inputText style="width:60px"  value ="#{lineEntry.price}">
                                                                                <p:ajax update="totalPrice"/>
                                                                            </p:inputText>
                                                                        </f:facet>
                                                                    </p:cellEditor>

                                                                </p:column>

                                                                <p:column headerText="Total Price">
                                                                    <h:outputText id="totalPrice" value="#{lineEntry.totalPrice}"/>
                                                                </p:column>
                                                            </p:dataTable></td></tr>
                                                </table>

                                                <p:outputPanel>  
                                                    <p:commandButton value="Save" update="panel" actionListener="#{SalesInquiryManagedBean.save}"   
                                                                     oncomplete="inquiryDialog.hide()" image="ui-icon ui-icon-check" />  
                                                    <p:commandButton value="Cancel" onclick="inquiryDialog.hide()" type="button" image="ui-icon ui-icon-close"/>  
                                                </p:outputPanel> 
                                            </center>
                                        </p:panel>
                                        <!--</h:panelGrid>-->
                                    </p:dialog>

                                    <!--DIALOG FOR DELETING A  SINGLE ROW-->
                                    <p:confirmDialog message="Are you sure you want to delete this sales inquiry?"  
                                                     showEffect="blind" hideEffect="blind"  
                                                     modal="true" header="Delete Sales Inquiry" severity="alert" widgetVar="customerdialog">  
                                        <center>
                                            <p:commandButton value="Yes" update="panel" ajax="true" immediate="true" oncomplete="customerdialog.hide()"  
                                                             actionListener="#{SalesInquiryManagedBean.delete}" />  
                                            <p:commandButton value="No" onclick="customerdialog.hide()" type="button" />   
                                        </center>

                                    </p:confirmDialog>  


                                    <!--DIALOG FOR DELETING MULTIPLE ROW OF INQUIRIES-->
                                    <p:dialog header="Delete Selected Records" modal="true" widgetVar="deleteDialog">

                                        <h:outputText value="You are about to permanently delete records." /><br /><br />
                                        <h:outputText value="Are you sure you want to continue?" /><br /><br/>

                                        <center>
                                            <p:commandButton value="Yes" ajax="true" immediate="true" update="panel" 
                                                             oncomplete="deleteDialog.hide()" actionListener="#{SalesInquiryManagedBean.deleteInquiries}" />
                                            <p:commandButton value="No" oncomplete="deleteDialog.hide()" action="#{SalesInquiryManagedBean.cancelDelete()}" /> 

                                        </center>
                                    </p:dialog>

                                    <!--DIALOG FOR CONVERTING SALES INQUIRIES TO QUOTATION-->
                                    <p:dialog header="Convert Inquiry to Quotation" widgetVar="convertToQuotation" resizable="false"  
                                              modal="true" width="700" showEffect="drop" hideEffect="drop">  
                                        <center>
                                            <h:panelGrid id="display2" columns="3" cellpadding="4" style="font-family:Tahoma;font-size:12px" >  


                                                <h:outputText value="ID" />
                                                <h:outputText value=":"/>                                  
                                                <h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.id}" />  

                                                <h:outputText value="Date Issued" />
                                                <h:outputText value=":"/>                                  
                                                <h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.dateIssued}"/>

                                                <h:outputText value="Client ID" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.clientId}" />  

                                                <h:outputText value="Client Name" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{SalesInquiryManagedBean.selectedViewInquiry.clientName}" />  

                                                <h:outputText value="Valid Until" />
                                                <h:outputText value=":"/>
                                                <h:panelGroup>  
                                                    <p:calendar value="#{SalesInquiryManagedBean.validUntil}" pattern="dd/MM/yyyy" showOn="button"/> 
                                                </h:panelGroup>  

                                                <h:outputText value="Quotation Name" />
                                                <h:outputText value=":"/>
                                                <h:panelGroup>  
                                                    <p:inputText value="#{SalesInquiryManagedBean.quotationName}"/> 
                                                </h:panelGroup> 

                                                <h:outputText value="Quotation Description" />
                                                <h:outputText value=":"/>
                                                <h:panelGroup>  
                                                    <p:inputText value="#{SalesInquiryManagedBean.quotationDescription}"/> 
                                                </h:panelGroup>




                                                <p:dataTable id="childPanel2" value="#{SalesInquiryManagedBean.selectedProductList}"
                                                             rowEditListener ="#{SalesInquiryManagedBean.onEditLineEntry}"
                                                             var="lineEntry" style="width:300px" >


                                                    <p:column style="width:20px">    
                                                        <p:rowEditor/>
                                                    </p:column>

                                                    <p:column headerText="Product ID">

                                                        <h:outputText value ="#{lineEntry.itemId}"/>
                                                    </p:column>

                                                    <p:column headerText="Product Name">
                                                        <h:outputText value="#{lineEntry.itemName}"/>
                                                    </p:column>

                                                    <p:column headerText="Quantity">
                                                        <p:cellEditor> 
                                                            <f:facet name="output">
                                                                <h:outputText value ="#{lineEntry.quantity}"/>
                                                            </f:facet>
                                                            <f:facet name="input">
                                                                <p:inputText style="width:50px" value ="#{lineEntry.quantity}">
                                                                    <p:ajax event="rowEdit" update="totalPrice"/>
                                                                </p:inputText>
                                                            </f:facet>
                                                        </p:cellEditor>

                                                    </p:column>

                                                    <p:column headerText="Base Unit Price">
                                                        <h:outputText value="#{lineEntry.basePrice}"/>
                                                    </p:column>

                                                    <p:column headerText="List Price">
                                                        <p:cellEditor>
                                                            <f:facet name="output">
                                                                <h:outputText value ="#{lineEntry.price}"/>
                                                            </f:facet>
                                                            <f:facet name="input">
                                                                <p:inputText style="width:50px"  value ="#{lineEntry.price}">
                                                                    <p:ajax update="totalPrice"/>
                                                                </p:inputText>
                                                            </f:facet>
                                                        </p:cellEditor>

                                                    </p:column>

                                                    <p:column headerText="Total Price">
                                                        <h:outputText id="totalPrice" value="#{lineEntry.totalPrice}"/>
                                                    </p:column>
                                                </p:dataTable>

                                                <f:facet name="footer">
                                                    <p:outputPanel layout="block" style="text-align:right; font-family:Helvetica;font-size:12px">  
                                                        <p:commandButton value="Convert to Quotation" update="panel growl" actionListener="#{SalesInquiryManagedBean.convertSalesInquiry}"   
                                                                         oncomplete="convertToQuotation.hide()" image="ui-icon ui-icon-transfer-e-w"/>  
                                                        <p:commandButton value="Cancel" onclick="convertToQuotation.hide()" type="button" image="ui-icon ui-icon-close"/>  

                                                    </p:outputPanel>  
                                                </f:facet>


                                            </h:panelGrid>  </center>
                                    </p:dialog>
                                </td>
                            </tr>
                        </table>

                    </div>
                    <div id="bottom" class="bottom">
                        <h:graphicImage value="/image/merlionfooter.jpg"/>
                    </div>
                </h:form>
            </h:body>
        </f:view>
    </f:view>
</html>